//    Copyright (C) Kherty.  All rights reserved.
using System.Collections.Generic;
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public class CustomDashProperties : LineDashProperties
    {
        private List<DashStop> ds;

        public List<DashStop> Stops
        {
            get { return ds; }
            set { ds = value; }
        }

        internal override void ReadXmlCore(ReadContext context)
        {
            using (var c = context.Read("custDash"))
            {
                Stops.Clear();
                while (c.ReaderLocalName == "ds")
                {
                    Stops.Add(c.ReadElement<DashStop>());
                }
            }
        }

        internal override void WriteXmlCore(WriteContext context)
        {
            using (WriteContext c = context.Write("custDash"))
            {
                foreach (DashStop ds2 in Stops)
                    c.WriteElement(ds2);
            }
        }
    }
}